package net.zigin.nhi.could.waste.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @program: dome
 * @description: oss相关配置参数
 * @author: yxiumei
 * @create: 2019-06-8 15:40
 **/
@Data
@Component
@ConfigurationProperties(prefix = "oss")
public class OssSecretKey {

    /** 阿里云API的内或外网域名 */
    private String endPoint;

    private String appKey;

    private String appSecret;

    /** 分区名字*/
    private String bucketName;

    /** 文件夹名称 */
    private  String folder;

    /** oss 域名 */
    private String baseUrl;

    @Bean
    public OSS ossClient(){
        OSS ossClient = new OSSClientBuilder().build(endPoint, appKey, appSecret);
        return ossClient;
    }

}

